Skip to main content

All Questions

Tagged with
4votes
2answers
450views

Replace array element with multiplication of neighbors in Scala

Given an array of integers, update the index with multiplication of previous and next integers, Input: 2 , 3, 4, 5, 6 Output: 2*3, 2*4, 3*5, 4*6, 5*6 Following ...
vikrant's user avatar
4votes
1answer
929views

Longest Substring Without Repeating Characters in Scala

Question is taken from Leetcode and solution works for their test cases. I do see a scope of improvement and make it more functional (getting rid of vars and mutables data structures). Please suggest ...
vikrant's user avatar
1vote
1answer
99views

Check if list contains a pair which adds up to a given sum

Kindly review this scala code for given problem and suggest improvements. Problem - Given an array of integers and a target sum, check if array contains a pair which adds up to sum. Example - <...
vikrant's user avatar
1vote
1answer
64views

Find the combination of matches which are closest to each other

Problem - Given three sorted arrays find combinations which are closest to each other. example - ...
vikrant's user avatar
2votes
1answer
142views

Project Euler 4 The Functional Way

I'm learning Scala (and functional programming). Is there a better way to solve Euler problem 4 than either of these two solutions. Euler 4 I like this array comprehension solution, but it wastes so ...
Josh Horowitz's user avatar
3votes
2answers
3kviews

Checking if two byte arrays are the same

I have a method to compare two byte arrays. The code is Java-style, and there are many if-elses. ...
Freewind's user avatar

close